function d=cal_dist_cos(c1,c2,pars)
    CENTER_X=pars(1);
    CENTER_Y=pars(2);
    DX=pars(3);
    DY=pars(4);
    FOCALLENGTH=pars(5);
    FOCALLENGTH_POW2=FOCALLENGTH*FOCALLENGTH;
    tempa = (c1(1) - CENTER_X) * DX;
    tempb = (c1(2) - CENTER_Y) * DY;
    denominator = sqrt(tempa * tempa + tempb * tempb + FOCALLENGTH_POW2);
    v1 = -tempa / denominator;
    v2 = -tempb / denominator;
    v3 = FOCALLENGTH / denominator;

    tempa = (c2(1) - CENTER_X) * DX;
    tempb = (c2(2) - CENTER_Y) * DY;
    denominator = sqrt(tempa * tempa + tempb * tempb + FOCALLENGTH_POW2);
    u1 = -tempa / denominator;
    u2 = -tempb / denominator;
    u3 = FOCALLENGTH / denominator;
    d=double((u1 * v1 + u2 * v2 + u3 * v3)/ (sqrt(u1 * u1 + u2 * u2 + u3 * u3) ...
        * sqrt(v1 * v1 + v2 * v2 + v3 * v3)));

end
